$(function () {
    var token = sessionStorage.getItem("token");
    var method = "Bankcredit|get_list";
    var pagesize = "6";
    var url = "http://www.rice.com/app/api/h5_access";
    var p = 1;
    xymore();
    $(".More").click(function () {
        p += 1;
        $(this).attr("disabled", "disabled");
        setTimeout(function () {
            $(".More").removeAttr("disabled");
        }, 2000);
        xymore(p);
    })

    function xymore(p) {
        if (!p) {
            p = "1";
        }
        var d = {};
        d.token = token;
        d.method = method;
        d.pagesize = pagesize;
        d.p = p;
        $.ajax({
            type: "post",
            url: url,
            data: d,
            dataType: "json",
            success: function (result) {
                if (result.status == "1") {
                    console.log(result);
                    var data = result.data.credit;
                    var sttr = $(".xlb").html();;
                    for (var i in data) {
                        sttr += ' <div class="xyk_xq am-u-sm-12 gradien-bg-x" data-id="' + data[i].bank_credit_id + '" style="cursor:pointer;border-radius:10px;margin-bottom:10px;"><div class="am-u-sm-4" style="text-align: center;padding: 12px 0 10px 0;"><img src="' + data[i].logo_url + '" style="width:50px;" alt="" /></div>';
                        sttr += '<div class="am-u-sm-8" style="padding: 5px 0 5px 0;"><div style="color: #fff;font-size: 14px;">' + data[i].cardName + '</div>';
                        sttr += '<div style="font-size: 14px ;color: #fff;">*** *** **** ' + data[i].cardAfterFour + '</div>';
                        sttr += '<div style="font-size: 14px;color: #fff;">账单日:' + data[i].statement_date + ' &nbsp;&nbsp; &nbsp;   还款日: ' + data[i].repayment_date + '</div>';
                        sttr += '</div></div>';
                    }
                    $(".xlb").html(sttr);
                    $(".xyk_xq").click(function () {
                        var dadid = $(this).attr("data-id");
                        sessionStorage.setItem("dadid", dadid);
                        location.href = "yinhang.html";
                    })
                } else if (result.status == "2") {
                    alert(result.message);
                    location.href = "login.html";
                } else {
                    alert(result.message);
                }
            }
        })

    }



})